<article class="" id="post-">
<header class="entry-header">
<h1 class="entry-title">event.delegateTarget</h1>
<div class="entry-meta">
						所属分类：<span class="category"><a href="/category/events/">事件</a> &gt; <a href="/category/events/event-object/">事件对象</a></span><span class="category-divider"> | </span><span class="category"><a href="/category/events/">事件</a></span>
<span class="pull-right">英文文档：<a href="https://api.jquery123.com/event.delegateTarget/" target="_blank">event.delegateTarget</a></span>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<!-- .entry-header -->
<div class="entry-content">
<article class="entry property" id="event-delegateTarget1"><h2 class="section-title">
<span>event.delegateTarget</span><span class="returns">返回: <a href="/Types/#Element">Element</a></span>
</h2>
<div class="entry-wrapper">
<p class="desc"><strong>描述: </strong>绑定了当前正在调用jQuery 事件处理器的元素。</p>
<ul class="signatures"><li class="signature"><h4 class="name">
<span class="version-details">添加的版本: <a href="/category/version/1.7/">1.7</a></span>event.delegateTarget</h4></li></ul>
<div class="longdesc" id="entry-longdesc">
<p>此属性经常用在是通过<a href="/delegate"><code>.delegate()</code></a> 或<a href="/on"><code>.on()</code></a>绑定委派的事件里，事件处理程序绑定在正在处理的元素的祖先上。它可用于，例如，在代理函数内使用它来识别并移除事件处理程序。</p>
<p>对于委派事件处理程序而言，由于事件是直接绑定在元素上的，也就是<code>event.delegateTarget</code> 总是等价于<code>event.currentTarget</code>.</p>
</div>
<section class="entry-examples" id="entry-examples"><header><h2 class="underline">例子:</h2></header><div class="entry-example" id="example-0">
<h4><span class="desc">点击任何在 box 样式里的按钮时，将 box 样式的背景色变成红色。</span></h4>
<div class="syntaxhighlighter javascript ">
<table>
<tbody>
<tr>
<td class="gutter">
<div class="line n1">1</div>
<div class="line n2">2</div>
<div class="line n3">3</div>
</td>
<td class="code">
<pre><div class="container"><div class="line"><code>$(<span class="string">".box"</span>).on(<span class="string">"click"</span>, <span class="string">"button"</span>, <span class="keyword">function</span>(event) {</code></div></div><div class="container"><div class="line"><code>  $(event.delegateTarget).css(<span class="string">"background-color"</span>, <span class="string">"red"</span>);</code></div></div><div class="container"><div class="line"><code>});  </code></div></div></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div></section>
</div></article> </div>
</article>